<template>
	<view class="grid-list" style="padding: 0px 15px;">
		<view class="grid-item" @click="clickRow(index)" v-for="(item,index) in dataList" :key="index">
			<GridItemCell :dataModel="item"> </GridItemCell>
		</view>

	</view>
</template>

<script>
	import GridItemCell from '../home-page/grid-item-cell.vue'

	export default {
		components: {
			GridItemCell
		},
		data() {
			return {
				dataList: [],
				idList: []
			}
		},
		onLoad() {
			this.idList = this.$idList;
			this.getList();
		},
		methods: {
			getList() {
				this.$uniCloudApi.getMyResources_data_list(this.idList).then(res => {
					this.dataList = res;
				});
			},
			clickRow(index) {
				var model = this.dataList[index];
				uni.navigateTo({
					url: '../resource-details-page/resource-details-page?model=' + this.$encodeJson(model)
				});
				// uni.navigateTo({
				// 	url: '../result-page/result-page?model=' + this.$encodeJson(model)
				// });

			},

		}
	}
</script>

<style lang="scss" scoped>
	.grid-list {
		display: flex;
		flex-wrap: wrap;
	}

	.grid-item {
		width: 50%;
		/* 每行三个，可根据需求调整 */
		display: flex;
		flex-direction: column;
		align-items: center;
	}
</style>